<!-- 模板 -->
<template>
  <div class="root">
    <el-header>
      <img src="../assets/logo.png" alt="" />
      <el-menu
        class="el-menu-vertical-demo"
        background-color="#006699"
        text-color="#fff"
        active-text-color="#fff"
        unique-opened
        mode="horizontal"
      >
        <!--   -->
        <el-submenu
          :index="item.id + ''"
          v-for="item in navList"
          :key="item.id"
        >
          <template slot="title">
            <i :class="item.icon"></i>
            <span>{{ item.title }}</span>
          </template>
          <el-menu-item
            :index="it.path"
            v-for="it in item.children"
            :key="it.id"
            @click="toComp(it.path)"
          >
            {{ it.title }}
          </el-menu-item>
        </el-submenu>
      </el-menu>
      <div class="user">
        <a href="javascript:;">{{ user }}</a
        >|<span @click="logout">LoGout</span>
      </div>
    </el-header>
    <el-main>
      <router-view></router-view>
    </el-main>

    <el-footer class="footer"
      >Copyrightc 2022 Institute of Plasma Physics
    </el-footer>
  </div>
</template>
<script>
// import request from '../utils/request.js'
import navList from "../utils/nav.js";
export default {
  data() {
    return {
      user: "admin",
      navList,
    };
  },
  props: [],
  components: {},
  computed: {},
  filters: {},
  methods: {
    handleSelect(key, keyPath) {
      console.log(key, keyPath);
    },
    logout() {
      this.$router.push("/");
    },
    toComp(path) {
      console.log(path);
      this.$router.push(path);
    },
  },
  created() {},
  mounted() {},
};
</script>
<style lang="less" scoped>
.el-header {
  background: #006699;
  display: flex;
  justify-content: space-around;
  align-items: center;
  /deep/ .el-menu-vertical-demo {
    display: flex;
    border: none !important;
    li {
      width: 200px;
      height: 60px !important;
      .el-submenu__title {
        height: 100% !important;
      }
      ul {
        z-index: 999 !important;
      }
    }
  }
  img {
    height: 100%;
  }
  .user {
    color: #eaf2f6;
    a {
      color: #eaf2f6;
      padding-right: 10px;
    }
    span {
      color: #eaf2f6;
      font-size: 16px;
      padding-left: 10px;
      text-decoration: underline;
    }
  }
}
.footer {
  text-align: center;
  color: #adadad;
  font-size: 14px;
  line-height: 21px;
}
// @import url(); 引入公共css类
</style>
